<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>编辑</title>
<link href="<?php echo $this->baseUrl;?>/admincss/style.css" rel="stylesheet" type="text/css" />

<script charset="utf-8" src="<?php echo $this->baseUrl;?>/adminjs/kindeditor-min.js"></script>
<script charset="utf-8" src="<?php echo $this->baseUrl;?>/adminjs/jquery.pack.js"></script>
<script charset="utf-8" src="<?php echo $this->baseUrl;?>/adminjs/lang/zh_CN.js"></script>
<script>
var editor;
KindEditor.ready(function(K) {
        editor = K.create('#content', {
		uploadJson : '<?php echo $this->url ($this->baseUrl, "article", "upload", "", "admin");?>',
		fileManagerJson : '<?php echo $this->url ($this->baseUrl, "article", "filemanage", "", "admin");?>',
		allowFileManager : true,
		urlType:"domain"
        });
});

$(function (){
	$("#button_submit").click(doFromSubmit);
})


var sflag = false;
function doFromSubmit()
{
	if (sflag)
	{
		alert("邮件发送中...");
		return false;
	}
	
	editor.sync();
	var url = "<?php echo $this->url ($this->baseUrl, "meeta", "domail");?>";
	
	var title = $("#title").val();
	var content = $("#content").val();
	var email = $("#email").val();

	if (title == ""){
		alert("请填写标题");
		return false;
	}

	if (content == "" || content.length < 10){
		alert("内容至少10个字符");
		return false;
	}

	var param = {title:title,content:content, email:email};
	$.post(url, param, function (ret){
		if (ret.status){
			alert("发送成功");
			parent.tb_remove();
		}else{
			alert(ret.message);
		}
		sflag = false;
	}, "json");
	sflag = true;
}
</script>

</head>
<body>
<form id="form1" name="form1" method="post" enctype="multipart/form-data" action="">

  <table border="1" class="tableA" align="center">
    <tr>
      <td colspan="2" align="center">发送邮件</td>
    </tr>
        <tr>
      <td nowrap="nowrap">收件人邮箱</td>
      <td>
      <input readonly="readonly" name="email" type="text" id="email" size="50" value="<?php echo $this->email;?>" /></td>
    </tr>
        <tr>
      <td>标题</td>
      <td>
      <input name="title" type="text" id="title" size="50" value="<?php echo $this->title;?>" /></td>
    </tr>
        <tr>
      <td>内容</td>
      <td>
<textarea name="content" id="content" cols="60" rows="30" style="width:680px;height:300px;"><?php echo $this->content;?></textarea></td>
    </tr>
    
    
    <tr>
      <td colspan="2" align="center">
      <input type="button" name="button_submit" id="button_submit" value="提交" class="btn_submit"/>
      <input type="button" onclick="javascript:parent.tb_remove();" name="button_cancel" id="button_cancel" value="关闭" class="btn_submit"/>
      
      </td>
    </tr>
  </table>
</form>
</body>
</html>